package com.carcontrol.rotate;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BootBroadcastReceiver extends BroadcastReceiver {
    static final String ACTION = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.e("onReceive===", context+"==="+intent);

        if (intent.getAction().equals(ACTION)) {
            Intent mainActivityIntent =new Intent(context, MainActivity.class);// 要启动的Activity
//            mainActivityIntent.setAction("android.intent.action.MAIN");
//            mainActivityIntent.addCategory("android.intent.category.LAUNCHER");
            mainActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(mainActivityIntent);
        }
    }
}
